Skip to content

fix: resolve cross-package test failures and type errors#44

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2478-1781589118
Open

fix: resolve cross-package test failures and type errors#44
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2478-1781589118

Conversation

@stooit

@stooit stooit commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and type errors in the monorepo. bun test is now 13 pass / 0 fail and npx tsc --noEmit is clean. No test files were modified and no dependencies were added.

Bugs fixed

  • Renamed hook (cross-package): apps/web/src/lib/api.ts imported useThrottle from @e2e/utils, but the hook was renamed to useDebounce. Updated the import.
  • Missing a11y attribute: packages/ui/.../Button.tsx never forwarded the aria-label prop. Now applies aria-label, with a fallback so icon-only buttons always emit a non-null label, while normal text buttons emit none.
  • Stale closure: packages/ui/.../DataTable.tsx handleSort toggled sort direction from a captured sortDir. Switched to the functional updater setSortDir(prev => ...) so repeated clicks toggle correctly.
  • Wrong date format: packages/utils/src/format/date.ts produced US MM/DD ordering under en-AU. Now uses dateStyle: "short" for the expected DD/MM ordering.

Test-infrastructure fixes (config only, no tests touched)

  • DOM environment: bun test from the root never registered a DOM, so all React component tests threw document is not defined. Registered happy-dom (already installed) via bunfig.toml [test] environment + preload of the existing setup script.
  • bun:test types: added bun-types (already a devDependency) to tsconfig.json compilerOptions.types so tsc resolves bun:test imports in test files.

Verification

  • bun test -> 13 pass, 0 fail
  • npx tsc --noEmit -> no errors

Assumptions

  • date.ts uses dateStyle: "short", which yields non-zero-padded values (e.g. 15/6/24); the date tests assert via prefix regex and pass. Did not change tests to require zero-padding.
  • Fixes were kept minimal and scoped strictly to what the tests require.

- ui/bunfig + root bunfig: register happy-dom environment so React component tests have a DOM
- web/api: import renamed hook useDebounce (was useThrottle) from @e2e/utils
- tsconfig: add bun-types so bun:test resolves under tsc
- Button: forward aria-label with icon-only fallback for a11y
- DataTable: use functional state updater to fix stale-closure sort toggle
- format/date: use en-AU dateStyle:short for DD/MM/YYYY ordering
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant